<!DOCTYPE html>
<html lang=en>
<head>
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集合中存入一个相同的key，不同的value值得时候就必须使用Map&lt;Integer,List&gt;模式来存数据，这样做很麻烦，而且编程效率又很低； 1. 现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说">
<meta property="og:type" content="article">
<meta property="og:title" content="在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集">
<meta property="og:url" content="http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/index.html">
<meta property="og:site_name" content="TmoonSite">
<meta property="og:description" content="在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集合中存入一个相同的key，不同的value值得时候就必须使用Map&lt;Integer,List&gt;模式来存数据，这样做很麻烦，而且编程效率又很低； 1. 现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2015-02-27T04:02:17.000Z">
<meta property="article:modified_time" content="2020-01-07T10:48:14.962Z">
<meta property="article:author" content="Tmoonlight">
<meta name="twitter:card" content="summary">
    
    
        
          
              <link rel="shortcut icon" href="/images/favicon.ico">
          
        
        
          
            <link rel="icon" type="image/png" href="/images/logo2.gif" sizes="192x192">
          
        
        
          
            <link rel="apple-touch-icon" sizes="180x180" href="/images/logo2.gif">
          
        
    
    <!-- title -->
    <title>在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集</title>
    <!-- styles -->
    
<link rel="stylesheet" href="/css/style.css">

    <!-- persian styles -->
    
      
<link rel="stylesheet" href="/css/rtl.css">

    
    <!-- rss -->
    
    
<meta name="generator" content="Hexo 4.2.0"></head>

<body class="max-width mx-auto px3 ltr">
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="/projects_url">Projects</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <ul>
        
        <li><a class="icon" href="/2015/03/08/%E7%89%A9%E4%BD%93%E6%97%8B%E8%BD%AC%E4%BB%A5%E5%8F%8A%E6%9C%9D%E5%90%91/"><i class="fas fa-chevron-left" aria-hidden="true" onmouseover="$('#i-prev').toggle();" onmouseout="$('#i-prev').toggle();"></i></a></li>
        
        
        <li><a class="icon" href="/2015/01/30/Unity3D%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%AE%9E%E7%8E%B0%E4%B8%80%E4%B8%AA%E7%89%A9%E4%BD%93%E4%BF%9D%E6%8C%81%E9%9D%A2%E5%90%91%E5%8F%A6%E4%B8%80%E4%B8%AA%E7%89%A9%E4%BD%93%EF%BC%88%E6%97%8B%E8%BD%AC%EF%BC%89-%E9%AB%98%E5%89%91%E7%9A%84%E4%B8%93%E6%A0%8F-%E5%8D%9A%E5%AE%A2%E9%A2%91%E9%81%93-CSDN.NET/"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li>
        <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li>
      </ul>
      <span id="i-prev" class="info" style="display:none;">Previous post</span>
      <span id="i-next" class="info" style="display:none;">Next post</span>
      <span id="i-top" class="info" style="display:none;">Back to top</span>
      <span id="i-share" class="info" style="display:none;">Share post</span>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/" target="_blank" rel="noopener"><i class="fab fa-facebook " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&text=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-twitter " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&is_video=false&description=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集&body=Check out this article: http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/"><i class="fas fa-envelope " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-reddit " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-digg " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&name=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集&description=" target="_blank" rel="noopener"><i class="fab fa-tumblr " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://news.ycombinator.com/submitlink?u=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&t=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-hacker-news " aria-hidden="true"></i></a></li>
</ul>

    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#null"><span class="toc-number">1.</span> <span class="toc-text"></span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说的功能，先看下Multimap接口的源码"><span class="toc-number">1.0.0.0.1.</span> <span class="toc-text">1. 现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说的功能，先看下Multimap接口的源码</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-ImmutableMultimap不可变集合"><span class="toc-number">1.0.0.0.2.</span> <span class="toc-text">2. ImmutableMultimap不可变集合</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-LinkedHashMultimap实现类"><span class="toc-number">1.0.0.0.3.</span> <span class="toc-text">3.LinkedHashMultimap实现类</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#4-TreeMultimap实现类"><span class="toc-number">1.0.0.0.4.</span> <span class="toc-text">4.TreeMultimap实现类</span></a></li></ol></li></ol></li></ol></li></ol></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index py4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">TmoonSite</span>
      </span>
      
    <div class="postdate">
      
        <time datetime="2015-02-27T04:02:17.000Z" itemprop="datePublished">2015-02-27</time>
        
      
    </div>


      

      

    </div>
  </header>
  

  <div class="content" itemprop="articleBody">
    <h1 id=""><a href="#" class="headerlink" title=""></a></h1><p>在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集合中存入一个相同的key，不同的value值得时候就必须使用Map&lt;Integer,List<Object>&gt;模式来存数据，这样做很麻烦，而且编程效率又很低；</p>
<h5 id="1-现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说的功能，先看下Multimap接口的源码"><a href="#1-现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说的功能，先看下Multimap接口的源码" class="headerlink" title="1. 现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说的功能，先看下Multimap接口的源码"></a>1. 现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说的功能，先看下Multimap接口的源码</h5><p>@GwtCompatiblepublic interface Multimap&lt;K, V&gt; {</p>
<p>//返回Multimap集合的key、value pair的数量</p>
<p>int size();</p>
<p>//判断Multimap是否包含key、value pair</p>
<p>boolean isEmpty();</p>
<p>//判断Multimap中是否包含指定key的value值</p>
<p>boolean containsKey(@Nullable Object key);</p>
<p>//判断Multimap中是否包含指定value的key</p>
<p>boolean containsValue(@Nullable Object value);</p>
<p>//判断Multimap中是否包含指定的key-value pair的数据</p>
<p>boolean containsEntry(@Nullable Object key, @Nullable Object value);</p>
<p>//将数据加入到Multimap中</p>
<p>boolean put(@Nullable K key, @Nullable V value);</p>
<p>//删除Multimap中指定key-value pair</p>
<p>boolean remove(@Nullable Object key, @Nullable Object value);</p>
<p>//将指定的key-集合数据加入Multimap中</p>
<p>boolean putAll(@Nullable K key, Iterable&lt;? extends V&gt; values);</p>
<p>//将指定的Multimap和当前的Multimap合并</p>
<p>boolean putAll(Multimap&lt;? extends K, ? extends V&gt; multimap);</p>
<p>//替换指定key的value</p>
<p>Collection<V> replaceValues(@Nullable K key, Iterable&lt;? extends V&gt; values);</p>
<p>//删除Imultimap中的指定key数据</p>
<p>Collection<V> removeAll(@Nullable Object key);</p>
<p>//清空Imultimap中的数据</p>
<p>void clear();</p>
<p>//获取指定key的值</p>
<p>Collection<V> get(@Nullable K key);</p>
<p>//获取所有的key集合</p>
<p>Set<K> keySet();</p>
<p>Multiset<K> keys();</p>
<p>Collection<V> values();</p>
<p>Collection&lt;Map.Entry&lt;K, V&gt;&gt; entries();</p>
<p>Map&lt;K, Collection<V>&gt; asMap();</p>
<p>@Override</p>
<p>boolean equals(@Nullable Object obj);</p>
<p>@Override</p>
<p>int hashCode();</p>
<p>}</p>
<p>Multimap接口的实现类HashMultimap使用方法详解</p>
<p>创建HashMultimap对象</p>
<p>Multimap&lt;Integer, Integer&gt; map = HashMultimap.&lt;Integer, Integer&gt;create();</p>
<p>map.put(1, 2);</p>
<p>map.put(1, 2);</p>
<p>map.put(1, 3);</p>
<p>map.put(1, 4);</p>
<p>map.put(2, 3);</p>
<p>map.put(3, 3);</p>
<p>map.put(4, 3);</p>
<p>map.put(5, 3);</p>
<p>System.out.println(map);</p>
<p>{1=[4, 2, 3], 2=[3], 3=[3], 4=[3], 5=[3]}</p>
<p>1</p>
<p>从上面的结果集可以看出，key不可以重复，相同key的key-value pair 的value值是放在同一个数组中，相同的value会去重。</p>
<p>常用的方法示例</p>
<p>//判断集合中是否存在key-value为指定值得元素</p>
<p>System.out.println(map.containsEntry(1, 2));</p>
<p>System.out.println(map.containsEntry(1, 6));</p>
<p>//获取key为1的value集合</p>
<p>Collection<Integer> list = map.get(1);</p>
<p>System.out.println(list);</p>
<p>//返回集合中所有key的集合，重复的key将会用key * num的方式来表示</p>
<p>Multiset<Integer> set = map.keys();</p>
<p>System.out.println(set);</p>
<p>//返回集合中所有不重复的key的集合</p>
<p>Set<Integer> kset = map.keySet();</p>
<p>System.out.println(kset);</p>
<p>truefalse[4, 2, 3][1 x 3, 2 x 2, 3, 4, 5][1, 2, 3, 4, 5]</p>
<p>replaceValues替换Multimap中指定key的值</p>
<p>Collection<Integer> coll = map.replaceValues(1, Arrays.asList(1,7,8,9,10));</p>
<p>System.out.println(coll);</p>
<p>System.out.println(map);</p>
<p>[4, 2, 3]{1=[8, 9, 1, 10, 7], 2=[4, 3], 3=[3], 4=[3], 5=[3]}</p>
<p>replaceValues方法会替换掉key的value值，并且返回之前对应的值。</p>
<h5 id="2-ImmutableMultimap不可变集合"><a href="#2-ImmutableMultimap不可变集合" class="headerlink" title="2. ImmutableMultimap不可变集合"></a>2. ImmutableMultimap不可变集合</h5><p>ImmutableMultimap中提供了三个主要的静态方法of、builder、copyof;</p>
<p>//创建一个静态不可变的Multimap对象</p>
<p>Multimap&lt;Integer, Integer&gt; map = ImmutableMultimap.&lt;Integer, Integer&gt;of();</p>
<p>Multimap&lt;Integer, Integer&gt; map1 = ImmutableMultimap.&lt;Integer, Integer&gt;builder().build();</p>
<p>//从另外一个集合中复制数据元素到Multimap对象中</p>
<p>Multimap&lt;Integer, Integer&gt; map2 = ImmutableMultimap.copyOf(map);</p>
<h5 id="3-LinkedHashMultimap实现类"><a href="#3-LinkedHashMultimap实现类" class="headerlink" title="3.LinkedHashMultimap实现类"></a>3.LinkedHashMultimap实现类</h5><p>LinkedHashMultimap实现类与HashMultimap类的实现方法一样，唯一的区别是LinkedHashMultimap保存了记录的插入顺序，在使用Iterator循环遍历的时候先得到的肯定是先放入Multimap中的数据。</p>
<p>Multimap&lt;Integer, Integer&gt; map = LinkedHashMultimap.&lt;Integer, Integer&gt;create();</p>
<p>map.putAll(4, Arrays.asList(5,3,4,2,1,56));</p>
<p>map.putAll(3, Arrays.asList(3,4,2,6,8,7));</p>
<p>map.put(1, 2);</p>
<p>System.out.println(map);</p>
<p>运行结果是：</p>
<p>{4=[5, 3, 4, 2, 1, 56], 3=[3, 4, 2, 6, 8, 7], 1=[2]}</p>
<h5 id="4-TreeMultimap实现类"><a href="#4-TreeMultimap实现类" class="headerlink" title="4.TreeMultimap实现类"></a>4.TreeMultimap实现类</h5><p>TreeMultimap类继承成了Multimap接口，它的所有方法跟HashMultimap一样，但是有一点不同的是该类实现了SortedSetMultimap接口，该接口会将存入的数据按照自然排序，默认是升序。</p>
<p>Multimap&lt;Integer, Integer&gt; map = TreeMultimap.&lt;Integer, Integer&gt;create();</p>
<p>map.putAll(4, Arrays.asList(5,3,4,2,1,56));</p>
<p>map.putAll(3, Arrays.asList(3,4,2,6,8,7));</p>
<p>map.put(1, 2);</p>
<p>System.out.println(map);</p>
<p>返回的结果是：</p>
<p>{1=[2], 3=[2, 3, 4, 6, 7, 8], 4=[1, 2, 3, 4, 5, 56]}</p>
<p>Multimap接口的实现类不仅仅只有HashMultimap、TreeMultimap、LinkedHashMultimap、ImmutableMultimap这几种，还有其它的实现类，我会在以后的学习过程中详解。</p>

  </div>
</article>



        
          <div id="footer-post-container">
  <div id="footer-post">

    <div id="nav-footer" style="display: none">
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="/projects_url">Projects</a></li>
        
      </ul>
    </div>

    <div id="toc-footer" style="display: none">
      <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#null"><span class="toc-number">1.</span> <span class="toc-text"></span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#1-现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说的功能，先看下Multimap接口的源码"><span class="toc-number">1.0.0.0.1.</span> <span class="toc-text">1. 现在我们来介绍一种更高效的集合Multimap，它可以很简单的实现上面我们所说的功能，先看下Multimap接口的源码</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#2-ImmutableMultimap不可变集合"><span class="toc-number">1.0.0.0.2.</span> <span class="toc-text">2. ImmutableMultimap不可变集合</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#3-LinkedHashMultimap实现类"><span class="toc-number">1.0.0.0.3.</span> <span class="toc-text">3.LinkedHashMultimap实现类</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#4-TreeMultimap实现类"><span class="toc-number">1.0.0.0.4.</span> <span class="toc-text">4.TreeMultimap实现类</span></a></li></ol></li></ol></li></ol></li></ol></li></ol>
    </div>

    <div id="share-footer" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/" target="_blank" rel="noopener"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&text=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&is_video=false&description=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集&body=Check out this article: http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&title=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&name=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集&description=" target="_blank" rel="noopener"><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://news.ycombinator.com/submitlink?u=http://yoursite.com/2015/02/27/%E5%9C%A8%E4%BB%8B%E7%BB%8DMultimap%E4%B9%8B%E5%89%8D%E6%88%91%E4%BB%AC%E5%85%88%E8%AF%B4%E4%B8%80%E4%B8%8BMap,Map%E6%98%AF%E4%B8%80%E4%B8%AAkey%E3%80%81value%E7%B1%BB%E5%9E%8B%E7%9A%84%E9%94%AE%E5%80%BC%E5%AF%B9%E9%9B%86%E5%90%88%EF%BC%8C%E9%9B%86%E5%90%88%E4%B8%ADkey%E4%B8%8D%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E4%BD%86value%E5%8F%AF%E4%BB%A5%E9%87%8D%E5%A4%8D%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%9C%A8Map%E9%9B%86/&t=在介绍Multimap之前我们先说一下Map,Map是一个key、value类型的键值对集合，集合中key不可以重复，但value可以重复，如果我们想在Map集" target="_blank" rel="noopener"><i class="fab fa-hacker-news fa-lg" aria-hidden="true"></i></a></li>
</ul>

    </div>

    <div id="actions-footer">
        <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> Menu</a>
        <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> TOC</a>
        <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> Share</a>
        <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> Top</a>
    </div>

  </div>
</div>

        
        <footer id="footer">
  <div class="footer-left">
    Copyright &copy; 2020 Tmoonlight
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="/projects_url">Projects</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    </div>
    <!-- styles -->

<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">


<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">


    <!-- jquery -->

<script src="/lib/jquery/jquery.min.js"></script>


<script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script>

<!-- clipboard -->

  
<script src="/lib/clipboard/clipboard.min.js"></script>

  <script type="text/javascript">
  $(function() {
    // copy-btn HTML
    var btn = "<span class=\"btn-copy tooltipped tooltipped-sw\" aria-label=\"Copy to clipboard!\">";
    btn += '<i class="far fa-clone"></i>';
    btn += '</span>'; 
    // mount it!
    $(".highlight table").before(btn);
    var clip = new ClipboardJS('.btn-copy', {
      text: function(trigger) {
        return Array.from(trigger.nextElementSibling.querySelectorAll('.code')).reduce((str,it)=>str+it.innerText+'\n','')
      }
    });
    clip.on('success', function(e) {
      e.trigger.setAttribute('aria-label', "Copied!");
      e.clearSelection();
    })
  })
  </script>


<script src="/js/main.js"></script>

<!-- search -->

<!-- Google Analytics -->

<!-- Baidu Analytics -->

<!-- Disqus Comments -->


</body>
</html>
